package com.wanshi.servlet;

import com.wanshi.service.ProdService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/seller/jiaProd")
public class jiaProd extends HttpServlet {

    private ProdService prodService = new ProdService();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //id   state
        String id = request.getParameter("id");
        String state = request.getParameter("state");

        //2 操作数据库
        prodService.updateStateById(id,state);
        //3 页面跳转
        response.sendRedirect(request.getContextPath()+"/seller/findProdByUser");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}

